package cn.itcast.mobilebrowser.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import cn.itcast.mobilebrowser.activity.BookMarksFragment;
import cn.itcast.mobilebrowser.activity.HistoryFragment;

public class BookMarksPagerAdapter extends FragmentStateAdapter {

    public BookMarksPagerAdapter(FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        if (position == 0) {
            return BookMarksFragment.newInstance(position + 1);
        } else {
            return HistoryFragment.newInstance(position + 1);
        }
    }

    @Override
    public int getItemCount() {
        return 2;
    }
}
